import React, { Component } from 'react'
import Child from './Child'

export default class App extends Component {
  state = {
    num: 0,
  }
  handleClick = () => {
    // this.setState({ num: this.state.num + 1 })
    // this.setState({ num: 0 })
    this.setState({})
  }
  // New Props => 只要父组件触发了 render，默认情况下子组件就会更新
  render() {
    return (
      <div>
        App
        <button onClick={this.handleClick}>+1</button>
        <hr />
        <Child num={this.state.num} />
      </div>
    )
  }
}
